
<?php
    @include_once("./conn.php");
    @header("Content-Type:text/json;charset=utf-8");   // 将php的运行结果以 json数据输出到页面

    $gid = $_GET["gid"];

    $search = "select id,goodsId,goodsName,goodsPrice,smallPicList,bigPicList,goodsDetail from `goodslist` where goodsId = '$gid' ";

    $result = mysqli_query($conn,$search);

    $item = mysqli_fetch_assoc($result);

    $str = $item["bigPicList"];   //字符串(多个图片以逗号分隔)
    $arr = explode(",",$str);    // 拆分成数组 
    $item["bigPicList"] = $arr;   //默认返回第一个

    $str = $item["smallPicList"];   //字符串(多个图片以逗号分隔)
    $arr = explode(",",$str);    // 拆分成数组 
    $item["smallPicList"] = $arr;   //默认返回第一个

    echo json_encode($item);




?>